﻿using System;
using System.Data ;
using System.Linq;

namespace LayerEntity.Sistema
{
    public class EUbigeo
    {
        #region Constructores
        public EUbigeo(IDataRecord record)
        {
            try
            {
                this.Ubigeo = record["ubigeo"].ToString();
                this.Departamento = record["nom_depa"].ToString();
                this.Provincia = record["nom_prov"].ToString();
                this.Distrito = record["nom_dist"].ToString();
                object valor = record["id_estado"];
                this.IdEstado = Convert.ToInt32(valor);
            }
            catch (Exception ex)
            {
                Console.Write(ex.ToString());
            }
        }

        public EUbigeo()
        {
            this.Ubigeo = string.Empty ;
            this.Departamento = string.Empty ;
            this.Provincia = string.Empty;
            this.Distrito = string.Empty;
            this.IdEstado = 0;
        }

        #endregion

        #region Propiedades      

        public string Ubigeo { get; set; }

        public string Departamento { get; set; }

        public string Provincia { get; set; }

        public string Distrito { get; set; }

        public int IdEstado { get; set; }
        #endregion

        #region Metodos SobreEscritos
        public override string ToString()
        {
            return string.Format("{0} - {1} - {2}",  this.Distrito, this.Provincia, this.Departamento);
        }
        #endregion
    }
}